package com.huilian.iotbox.admin.wap.controller;

import com.huilian.iotbox.admin.wap.service.StatsLedgerMerchantService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.StatsLedgerMerchantDto;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/statsLedgerMerchant")
public class StatsLedgerMerchantController extends UserInfoController {
    @Autowired
    private StatsLedgerMerchantService statsLedgerMerchantService;

    /**
     * 查询分账收益
     * */
    @PostMapping("/findStatsLedgerMerchantData")
    public ServerResponse statsLedgerMerchantService(HttpServletRequest request, @RequestBody StatsLedgerMerchantDto statsLedgerMerchantDto){
        UserInfo userInfo = super.getLoginUserInfo(request);
        statsLedgerMerchantDto.setUserId(userInfo.getId());
        return statsLedgerMerchantService.statsLedgerMerchantService(statsLedgerMerchantDto);
    }

    /**
     * 查询分账合计
     * */
    @PostMapping("/finStatsLedgerMerchantTotal")
    public ServerResponse finStatsLedgerMerchantTotal(HttpServletRequest request, @RequestBody StatsLedgerMerchantDto statsLedgerMerchantDto){
        UserInfo userInfo = super.getLoginUserInfo(request);
        statsLedgerMerchantDto.setUserId(userInfo.getId());
        return statsLedgerMerchantService.finStatsLedgerMerchantTotal(statsLedgerMerchantDto);
    }
}
